import React from "react";
import  { useDidShow } from "@tarojs/taro";
import { Provider } from "react-redux";
import store from "./store";
import { getStorage } from "./utils/storage";
import { setGlobalData } from "./utils";
import { ActionSheetProvider } from "@expo/react-native-action-sheet";
import TabBar from "./components/tab-bar";




getStorage("accessToken").then((token) => {
  setGlobalData("accessToken", token);
});

getStorage("refreshToken").then(token => {
  setGlobalData("refreshToken", token);
});


const tabBarList = [{
  text: "鹿街",
  pagePath: "/pages/tab_home/index",
  icon: "\ue69b",

},  {
  text: "发现",
  pagePath: "/pages/tab_discover/index",
  icon: "\ue744"
},{
  text: "消息",
  pagePath: "/pages/tab_mall/index",
  icon: "\ue674"
}, {
  text: "我的",
  pagePath: "/pages/tab_my/index",
  icon: "\ue789"
}];



const App = (props) => {
  useDidShow(() => {
  });
  return (
      <Provider store={store} >
        <ActionSheetProvider>
        {props.children}
        </ActionSheetProvider>
        <TabBar current={0}  tabList={tabBarList} />
      </Provider>
  );
};

export default App;
